#ifndef LISTMAINTENCE_H
#define LISTMAINTENCE_H

#include <QObject>
#include <QDebug>
#include <QMap>
#include <QList>
#include <QString>
#include <QStringList>
#include <QDataStream>
#include <QFile>
#include "backendfiles/requestmanager.h"



class ListMaintence : public QObject
{
    Q_OBJECT
public:
    explicit ListMaintence(QObject *parent = 0);
    QList<QString>* collectionListContent();    
    QMap<QString,QMap<QString,QString>> collectionAssistList();
    QString itemInfo(const QString&item, const QString&property);
    QList<QString> collectionsList();
    int addCollection(const QString&);
    int remCollection(const QString&);
    int addItem( const QString&item);
    int remItem(const QString&);

    static ListMaintence * getInstance()
    {
        if(!p_instance)
            p_instance = new ListMaintence();
        return p_instance;
    }

    QString getCollectionName() const;
    void setCollectionName(const QString &value);

private:
    ~ListMaintence();
    static ListMaintence* p_instance;
    QString collectionName = "f1";
    QString realmName = "Eversong";
    QMap<QString,QList<QString>>  collections;
    QMap<QString,QMap<QString,QString>> itemInfoCash;
    QList<QString> currentCollList;
    QList<QString> fillList;
    QMap<QString,QList<QString>> realmsMap;
    int saveCollections();
    int loadCollections();
    int collectionFillGo();
    int collectionFillStep(bool);
    int saveCash();
    int loadCash();
signals:
    void itemUpdate();
public slots:
    QList<QString> realmsList(const QString&);

};

#endif // LISTMAINTENCE_H
